package kr.momo.itembox 
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author ...
	 */
	public class ItemBox extends Sprite 
	{
		private static const MIN_ITEM_BOX_WIDTH:Number = 400;
		
		private var bg:MC_ItemBox;
		
		private var _itemBoxWidth:Number;
		public function get itemBoxWidth():Number { return _itemBoxWidth; }
		
		private var itemArray:Array;
		
		private var itemContainer:Sprite;
		private var itemContainerMask:Shape;
		
		public function ItemBox() 
		{
			addEventListener(Event.ADDED_TO_STAGE, init);
			
		}
		
		private function init(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			bg = new MC_ItemBox();
			addChild( bg );
			
			itemArray = [];
			
			itemContainer = new Sprite();
			itemContainer.x = 15;
			itemContainer.y = 20;
			addChild( itemContainer );
			
			stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler );
			stage.addEventListener(Event.RESIZE, resizeHandler );
			
			resizeHandler();
		}
		
		private function resizeHandler(e:Event = null):void 
		{
			_itemBoxWidth = stage.stageWidth * 0.7;
			if ( _itemBoxWidth < MIN_ITEM_BOX_WIDTH ) {
				_itemBoxWidth = MIN_ITEM_BOX_WIDTH;
			}
			
			bg.width = _itemBoxWidth;
			
			itemContainer.graphics.clear();
			itemContainer.graphics.beginFill( 0x000000, 0.7 );
			itemContainer.graphics.drawRect( 0, 0, _itemBoxWidth - 150, 90 );
		}
		
		private function mouseUpHandler(e:MouseEvent):void 
		{
			
		}
		
	}

}